package com.android.delivery.activity.wangdian

import android.os.Bundle
import android.view.View
import androidx.fragment.app.Fragment
import com.android.delivery.R
import com.android.delivery.adapter.BaseFragmentStateAdapter
import com.android.delivery.base.BaseActivity
import kotlinx.android.synthetic.main.common_viewpager.*

/**
 * @author: mqwang
 * @create: 3/18/21 8:27 AM
 * @Description: 骑手-历史订单
 */
class RiderHistoryOrderActivity : BaseActivity(){

    private val mTitles: MutableList<String> = ArrayList()
    private val tabFragmentList: MutableList<Fragment> = ArrayList()


    override fun getLayoutId(): Int {
        return R.layout.common_viewpager

    }

    override fun init(savedInstanceState: Bundle?, container: View?) {
        setMainTitle("全部订单")

        mTitles.add("派件")
        mTitles.add("收件")

        tabFragmentList.add(RiderHistoryOrderListFragment.newInstance(0)!!)
        tabFragmentList.add(RiderHistoryOrderListFragment.newInstance(1)!!)


//        view_pager.setAdapter(PagerAdapter(supportFragmentManager, tabFragmentList, mTitles))
        view_pager.setAdapter(BaseFragmentStateAdapter(supportFragmentManager, tabFragmentList, mTitles))
        tab_layout.setupWithViewPager(view_pager) //此方法就是让tablayout和ViewPager联动
     }
}